<extend name="_Layout/main"/>
<block name="lbwindex">
    <div class="container">
        <div class="modal-content" style="border-radius:10px;">
            <div class="modal-header" style="background: #99cc99;color: #FFF;border-bottom: 1px solid #FFF;border-top-left-radius: 10px;border-top-right-radius: 10px;">
                <h4 class="modal-title">忘記密碼</h4>
            </div>
            <div class="modal-body">
                <div class="container-fluid">
                    <form class="form-horizontal" action="{:U('Home/User/restOnePwd')}" method="post">
                        <fieldset>
                        <div class="form-group">
                            <label  class="col-sm-2 control-label">新密碼<span class="check-tips"></span></label>
                            <div class="col-sm-5">
                                <input type="password" class="form-control" name="password" placeholder="請輸入新密碼">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputPassword3" class="col-sm-2 control-label">手機號</label>
                            <div class="col-sm-5">
                                <input type="text" name="mobile" class="form-control" placeholder="請輸入您的手機號">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputPassword3" class="col-sm-2 control-label">驗證碼</label>
                            <div class="col-sm-5">
                                <input type="text" class="form-control" name="verify" placeholder="請輸入驗證碼">
                            </div>
                            <button type="button" class="btn btn-default send-mobile-verify">發送短信驗證碼</button>
                        </div>
                        <!--<div class="form-group">
                            <label for="inputPassword3" class="col-sm-2 control-label">驗證碼<span style="color: #F30002;"> *</span></label>
                            <div class="col-sm-5">
                                <input type="text" class="form-control" name="verify"  placeholder="請輸入圖片中的驗證碼">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputPassword3" class="col-sm-2 control-label">驗證碼</label>
                            <div class="col-sm-5">
                                <img style="cursor: pointer;" class="verifyimg reload-verify" alt="驗證碼" onclick="yanzhengma();" src="{:U('Home/User/verify')}" title="點擊刷新">
                            </div>
                        </div> -->
                        <div class="modal-footer" style="border-top: 2px solid #99cc99;">
                            <button type="submit" id="lbw_sub" class="btn btn-default" style="background: #99cc99;border-color: #99cc99 !important;color: #FFF;">找回密碼</button>
                        </div>
                            </fieldset>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        document.onreadystatechange = function () {
            if (document.readyState == "complete") {
                $("#idCard").blur(function(){
                    var abcd =$("#idCard").val();
                    var ajaxdata = "&idcard="+abcd;
                    $.ajax({
                        type: "post",
                        url : "{:U('Home/User/idcard')}",
                        data: ajaxdata,
                        success: function(response){
                            if(response.indexOf("success")>=0){
                                $("#lbwid").html("身份證驗證成功");
                                $("#lbw_sub").attr("disabled",false);
                            }else if(response.indexOf("id card number not found!")>=0){
                                $("#lbwid").html("身份證號碼輸入錯誤,請正確輸入否則不能提交");
                                $("#lbw_sub").attr("disabled",true);
                            }else {
                                $("#lbwid").html("身份號碼不能爲空,請重新輸入否則不能提交");
                                $("#lbw_sub").attr("disabled",true);
                            }
                        }
                    });
                });
            }
        }
    </script>
    <script src="__HOME_JS__/jquery.zclip.min.js" type="text/javascript"></script>
    <script>
        function copyLink() {
            $('#copy_input').zclip({
                path: '__HOME_JS__/ZeroClipboard.swf',
                copy: function () {
                    return $('#lbwcopybutton').val();
                },
                afterCopy: function () {
                    alert("複制成功快去分享吧");
                }
            });
        }
    </script>
    <script type="text/javascript">
        $(function(){
            //發送驗證碼倒計時
            function time(that, wait){
                if(wait == 0){
                    $(that).removeClass('disabled').prop('disabled',false);
                    $(that).html('重新發送驗證碼');
                }else{
                    $(that).html(wait+'秒後重新發送');
                    wait--;
                    setTimeout(function(){
                        time(that, wait);
                    }, 1000);
                }
            }

            $('.send-mobile-verify').click(function(){
                var url;
                var that = this;
                if(url = "{:U('User/sendMobileVerify')}"){
                    var mobile = $('input[name="mobile"]').val();
                    var filter  = /^1\d{10}$/;
                    if(!filter.test(mobile)){
                        alert('手機號碼不正確');
                        $(that).addClass('disabled').prop('disabled', true);
                        time(that, 5);
                    }else{
                        $(that).addClass('disabled').prop('disabled', true);
                        time(that, 30);
                        $.post(url,{'mobile':mobile, 'title':'用戶注冊'}).success(function(data){
                            if(data.status == 1){
                                $.alertMessager(data.info, 'success');
                            }else{
                                $.alertMessager(data.info, 'danger');
                            }
                        });
                    }
                }
                return false;
            });
        });
    </script>
    <!--footer-end-->
</block>